<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        .container {
            width: 800px;
            height: 800px;
            background: pink;
        }
        .box1 {
            /* 隐藏不占位置 */
            width: 100px;
            height: 100px;
            background: gold;
            display: none;
        }
        .box2 {
            /* 隐藏占位 */
            visibility: hidden;
            width: 100px;
            height: 100px;
            background: green;
        }
        .box3 {
            /* 透明度0，占位 */
            opacity: 0;
            width: 100px;
            height: 100px;
            background: blue;
        }
        .box4 {
            width: 100px;
            height: 100px;
            background: skyblue;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="box1">box1</div>
        <div class="box2">box2</div>
        <div class="box3">box3</div>
        <div class="box4">box4</div>
    </div>
</body>
</html>